package com.steakliu.algorithm;

import java.util.HashMap;

/**
 * 功能说明：
 * <p>
 * Original @Author: steakliu-刘牌, 2022-08-27  22:54
 * <p>
 * Copyright (C)2020-2022  steakliu All rights reserved.
 */
public class TwoNumTotal {

    public static void main(String[] args) {
        int[] arr = {1,3,4,5,6,8,10,11};
        //solution(arr,14);
        //simple(arr,14);
        System.out.println(1 << 4);
    }

    private static void simple(int[] arr , int target){
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < arr.length; i++) {
            int temp = target - arr[i];
            if (map.containsKey(temp)){
                System.out.println("arr index ["+map.get(temp) + ","+i+"]");
            }
            map.put(arr[i],i);
        }
    }


    /**
     * brute solution
     * @param arr
     * @param target
     */
    private static void solution(int[] arr , int target){
        for (int i = 0; i < arr.length; i++) {
            for (int j = i; j < arr.length; j++) {
                if (arr[i] + arr[j] == target){
                    System.out.println("arr index ["+i + ","+j+"]");
                }
            }
        }
    }
}
